#!/usr/bin/env python
# encoding: utf-8
"""
@author:zwb
@file: link.py
@contact: zwb15083976291@163.com
@time: 2022/02/27
"""
from common.models import BlogLink
from common.serializers.serializer import LinkListSerializer
from utils.responses import CommonResponse
from utils.views import BaseGenericAPIView


class LinkListView(BaseGenericAPIView):
    diff_methods_serializer_class = dict(get=LinkListSerializer)

    def get(self, request):
        links = BlogLink.objects.all()
        link_data = self.get_serializer(links, many=True).data
        return CommonResponse(data=link_data)
